# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.contrib.auth.decorators import login_required
from main.views import EmployeeDetail, UnitsList, EmployeeByUnit,\
    DismissEmployee, ORepairEmployee, BDayTodayList, BDaysList, search, EmployeeDeleteView, EmployeeCreateView, EmployeeUpdateView
from django.contrib.auth import views as auth_views


urlpatterns = patterns('',
    url(r'^units/$', login_required(UnitsList.as_view()), name="units_list"),
    url(r'^bdays/(?P<month>\d+)/(?P<day>\d+)/$', BDaysList.as_view(), name="employees_bdays"),
    url(r'^bdays/today/$', BDayTodayList.as_view(), name="employees_bdays_today"),
    url(r'^employee/(?P<pk>[-\w]+)/$', login_required(EmployeeDetail.as_view()), name="employee_detail"),
    url(r'^employees/(?P<pk>[-\w]+)/$', login_required(EmployeeByUnit.as_view()), name="employee_list"),
    url(r'^dismissed/$', login_required(DismissEmployee.as_view()), name="dismissed_list"),
    url(r'^operative/$', login_required(ORepairEmployee.as_view()), name="orepair_list"),
    url(r'^search/$', login_required(search), name="search"),
    url(r'^delete/(?P<pk>[-\w]+)/$', login_required(EmployeeDeleteView.as_view()), name="employee_delete"),
    url(r'^create/$', login_required(EmployeeCreateView.as_view()), name="employee_create"),
    url(r'^update/(?P<pk>[-\w]+)/$', login_required(EmployeeUpdateView.as_view()), name="employee_update"),

    url(r'^login/$', auth_views.login, {'template_name': 'main/login.html'}, name='auth_login'),
    url(r'^logout/$', auth_views.logout, {'template_name': 'main/logout.html'}, name='auth_logout'),
    url(r'^password_reset/$', auth_views.password_reset, {'template_name':'main/password_reset_form.html', 'email_template_name':'main/password_reset_email.html'}),
    url(r'^password_reset/done/$', auth_views.password_reset_done, {'template_name':'main/password_reset_done.html'}),
    url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', auth_views.password_reset_confirm, {'template_name':'main/password_reset_confirm.html'}),
    url(r'^reset/done/$', auth_views.password_reset_complete, {'template_name':'main/password_reset_complete.html'}),
)